const { PIC_DEFAULT } = require('../conf/constants')

function _formatUserPicture(obj) {
    if(obj.picture == null) {
        obj.picture = PIC_DEFAULT
    }
    return obj
} 

/**
 * 
 * @param {Array|Object} list 
 */
function formatUser(list) {
    if(list === null) {
        return list
    }
    if(Array.isArray(list)) {
        return list.map(_formatUserPicture)
    }

    return _formatUserPicture(list)
}

module.exports = {
    formatUser
}